package com.fzl.spring_chatroom.controller;

import com.fzl.spring_chatroom.model.response.FriendInfoResponse;
import com.fzl.spring_chatroom.service.FriendService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/friend")
public class FriendController {
    @Autowired
    private FriendService friendService;

    @RequestMapping("/getFriendList")
    public List<FriendInfoResponse> getFriendList(Integer userId) {
        log.info("getFriendList");
        return friendService.getFriendList(userId);
    }

    @GetMapping("/isFriend")
    public boolean isFriend(@RequestParam Integer userId, @RequestParam Integer friendId) {
        return friendService.isFriend(userId, friendId);
    }

}
